package com.bitrate.dagger.restful.request;

import java.io.Serializable;

/**
 * 用来表明分页信息
 *
 */
public class PageInfo implements Serializable {

	private static final long serialVersionUID = -2736448684358714166L;

	private Integer pageNo = 1;

	private Integer pageSize = 10;

	private Long total;

	private Long pages;

	public Long getTotal() {
		return total;
	}

	public void setTotal(Long total) {
		this.total = total;
	}

	public Long getPages() {
		return pages;
	}

	public void setPages(Long pages) {
		this.pages = pages;
	}

	public PageInfo() {
	}

	public PageInfo(Integer pageNo, Integer pageSize) {
		this.setPageNo(pageNo);
		this.setPageSize(pageSize);
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
		if (this.pageSize < 1 || this.pageSize > 50)
			this.pageSize = 10;
	}

	public Integer getStart() {
		return (pageNo - 1) * pageSize;
	}

	public Integer getEnd() {
		return pageNo * pageSize - 1;
	}
}
